<?php

class Teacher_Model_DbTable_Teacher extends Zend_Db_Table_Abstract
{

    protected $_name = 'teachers';
    public function getAll(){
    	return $this->fetchAll();
    }
    
    public function getByID($id){
    	 return $this->fetchRow("teacher_id = $id");
    }
    
    public function addNew($tName,$desc,$skillID,$phone,$email,$img,$role){
    	 $data = array(
    	 		"teacher_name"=>$tName,
    	 		"description"=>$desc,
    	 		"skill_id"=>$skillID,
    	 		"phone"=>$phone,
    	 		"email"=>$email,
    	 		"image"=>$img,
    	 		"role"=>$role,
    	 		"status"=>0
    	 		);
    	 return $this->insert($data);
    }
    
    public function updateTeacher($id,$tName,$desc,$skillID,$phone,$email,$img,$role){
    	 $data = array(
    	 		"teacher_name"=>$tName,
    	 		"description"=>$desc,
    	 		"skill_id"=>$skillID,
    	 		"phone"=>$phone,
    	 		"email"=>$email,
    	 		"image"=>$img,
    	 		"role"=>$role,
    	 		"status"=>0
    	 		);
    	 return $this->update($data, "teacher_id = $id");
    }

}

